<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>购物车</title>
    <link href="./css/common.css" rel="stylesheet" type="text/css">
    <link href="./css/cart.css" rel="stylesheet" type="text/css">

</head>
<body>
<div th:replace="header.html"/>

<div class="container cart">
    <div class="span24">
        <form action="/submitOrder" method="post">
            <div class="step step1"></div>
            <table>
                <tbody>
                <th:block th:if="${session.CART.getAll()!=null and session.CART.getAll().size()!=0}">
                    <tr>
                        <th></th>
                        <th>图片</th>
                        <th>商品</th>
                        <th>价格</th>
                        <th>数量</th>
                        <th>小计</th>
                        <th>操作</th>
                    </tr>
                </th:block>
                <th:block th:if="${session.CART.getAll()==null or session.CART.getAll().size()==0}">
                    您的购物车空空如也，赶紧去购物吧！
                </th:block>
                    <tr th:each="item : ${session.CART.getAll()}">
                        <!-- 显示 选择的 checkbox,如果勾选表示要生成订单
                             往后台传一个 商品id,表示哪些商品被勾选-->
                        <td width="10">
                            <input type="checkbox" name="ids" th:value="${item.product.pid}">
                        </td>
                        <td width="60" >
                            <img th:src="${'http://localhost:8089/'+item.product.image}">
                        </td>
                        <td><a target="_blank" th:text="${item.product.pname}">...</a></td>
                        <td th:text="${'￥'+item.product.shopPrice}"></td>
                        <td class="quantity" width="60" th:text="${item.quantity}"></td>
                        <td width="140">
                            <span class="subtotal" th:text="${'￥'+item.subTotal}"></span>
                        </td>
                        <td><a th:href="${'deleteCart.do?pid='+item.product.pid}" class="delete">删除</a></td>
                    </tr>
                </tbody>
            </table>

            <dl id="giftItems" class="hidden" style="display: none;">
            </dl>
            <div class="total">
                <em id="promotion"></em>
                <em>登录后确认是否享有优惠</em>
                赠送积分: <em id="effectivePoint" th:text="${session.CART.total}"></em>
                商品金额: <strong id="effectivePrice" th:text="${'￥'+session.CART.total+'元'}"></strong>
            </div>
            <div class="bottom">
                <a href="clearCart" id="clear" class="clear">清空购物车</a>
                <input type="submit" class="submit" value="提交订单" />
            </div>
        </form>
    </div>
</div>
<div th:replace="footer.html"></div>

</body></html>